
<?php $this->pageTitle = Yii::t('MenuModule.base','Menu Manager: Menus');?>
<?php $this->breadcrumbs=array(
    Yii::t('MenuModule.base','Menus')=>array('index'),
    Yii::t('MenuModule.base','Menu manager'),
);?>

<?php Yii::app()->clientScript->registerScript('search', "
    $('.glyphicon').tooltip();
    $('.btn-primary').tooltip({container:'body'});
    $('#yt0').tooltip({container:'#manage_menu'});
    $('.search-button').click(function(){
        $('.search-form').toggle();
        return false;
    });
    $('.search-form form').submit(function(){
        $('#menu-grid').yiiGridView('update', {
            data: $(this).serialize()
        });
        return false;
    });
    $('#refresh').on('click',function(e){
        $.fn.yiiGridView.update('menu-grid');
    });
");?>
<div id="manage_menu">
    <div class="panel panel-primary">
        <div class="panel-heading">
            <i class="fa fa-cogs"></i><span class="h4"><?php echo Yii::t('MenuModule.base','Menu Manager: Menus')?></span><a id="refresh" class="alignRight white font16" href="#"><i class="fa fa-refresh"></i></a>
        </div>
        <div class="panel-body">
            <div class="search-form">
                <?php $this->renderPartial('_search',array(
                    'model'=>$model,
                    'columnName'=>'item_name'
                )); ?>
            </div><!-- search-form -->

            <?php $this->widget('zii.widgets.grid.CGridView', array(
                'id'=>'menu-grid',
                'dataProvider'=>$model->search(),
                //'filter'=>$model,
                'pager' => array('cssFile' => Yii::app()->theme->baseUrl . '/assets/gridview/pager.css'),
                'baseScriptUrl'=>Yii::app()->theme->baseUrl.'/assets/gridview',
                'cssFile'=> Yii::app()->theme->baseUrl . '/assets/gridview/styles.css',
                'columns'=>array(
                    array(
                        'class'=>'CCheckBoxColumn',
                        'selectableRows' => 2,
                        'checkBoxHtmlOptions' => array('class' => 'checkbox'),
                    ),
                    array(
                        'name' => 'id',
                        'type' => 'raw',
                        'htmlOptions' => array('style'=>'width:50px'),
                    ),
                    array(
                        'name' => 'item_name',
                        'type' => 'raw',
                        'value'=>'$data->getMenuLink()',
                       // 'htmlOptions' => array(),
                    ),
                    'title',
                    array(
                        'name' => 'published',
                        'type' => 'raw',
                        'value'=>'CHtml::tag("span",array("class"=>"badge"),$data->getPublishedItem())',
                    ),
                    array(
                        'name' => 'unpublished',
                        'type' => 'raw',
                        'value'=>'CHtml::tag("span",array("class"=>"badge"),$data->getUnpublishedItem())',
                    ),
                    array(
                        'class'=>'CButtonColumn',
                        'htmlOptions' => array('style'=>'width:150px;font-size:20px'),
                        'template'=>'{view}&nbsp{update}&nbsp{delete}',
                        'buttons'=>array(
                            'view'=>array(
                                'label'=>'',
                                'imageUrl'=>'',
                                'options'=>array('class'=>'glyphicon glyphicon-eye-open','style'=>'padding-right:5px','data-toggle'=>'tooltip','title'=>Yii::t('MenuModule.base','View')),
                            ),
                            'update'=>array(
                                'label'=>'',
                                'imageUrl'=>'',
                                'options'=>array('class'=>'glyphicon glyphicon-edit','style'=>'padding-right:5px','data-toggle'=>'tooltip','title'=>Yii::t('MenuModule.base','Edit')),
                            ),
                            'delete'=>array(
                                'label'=>'',
                                'imageUrl'=>'',
                                'options'=>array('class'=>'glyphicon glyphicon-trash','style'=>'padding-right:5px','data-toggle'=>'tooltip','title'=>Yii::t('MenuModule.base','Delete')),
                            ),
                        )
                    ),
                ),
            )); ?>
        </div>
    </div>
</div>